package com.xiaolin.dao;

import com.xiaolin.pojo.Friends;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author XiaoLin
 * @date 2019/2/25 08:03
 */
@org.apache.ibatis.annotations.Mapper
public interface FriendsMapper extends Mapper<Friends> {

    @Select("Select * from friends where my_uid = #{userId}")
    @Results({
            @Result(property = "myUid", column = "my_uid"),
            @Result(property = "myFriendUid", column = "my_friend_uid"),
            @Result(property = "myFriend", one = @One(select = "com.xiaolin.dao.UserMapper.selectFriendById"), column = "my_friend_uid"),
            @Result(property = "addTime", column = "add_time"),
            @Result(property = "hisRemark", column = "his_remark"),
            @Result(property = "tagId", column = "tag_id"),
//            @Result(property = "myTag", column = "tag_id"),
    })
    List<Friends> findFriendByMyId(String userId);
}
